define pic
  p /x *(cpu_ctxt_t*)(&_irq_stack_bottom - sizeof(cpu_ctxt_t))
end
document pic
  Prints the interrupt context.
end

define ckfreeppages
  set $elem = free_ppages.head
  set $ok = 1
  while $elem != 0
    if $elem->link.next && $elem->link.prev && ((((uintptr_t)$elem->link.next) & 0xf0000000) != (((uintptr_t)$elem->link.prev) & 0xf0000000))
       p "LIST CONSISTENCY: free ppages list not in same vm range"
       p $elem
       p *$elem
       set $ok = 0
    end
    set $elem = $elem->link.next
  end
  if $ok
    p "Free ppages consistency OK"
  end
end
document ckfreeppages
  Checks the consistency of the free_ppages list.
end
